// component/common/com-vip-pop/com-vip-pop.js
const computedBehavior = require('miniprogram-computed')

Component({
  behaviors: [computedBehavior],

  /**
   * 组件的属性列表
   */
  properties: {
    vipPopInfo: {
      type: Object,
      value: {}
    }
  },

  /**
   * 组件的初始数据
   */
  data: {
    contentList: []
  },

  watch: {
    'vipPopInfo.content': function(newVal, oldVal) {
      if (newVal) {
        this.setData({
          contentList: newVal.split('|')
        })
      }
    },
  },

  /**
   * 组件的方法列表
   */
  methods: {
    handleCancel() {
      this.data.vipPopInfo.fail && this.data.vipPopInfo.fail()
    },
    handleConfirm() {
      this.data.vipPopInfo.success && this.data.vipPopInfo.success()
    },
    goToMemberCentre() {
      this.data.vipPopInfo.extraCb && this.data.vipPopInfo.extraCb()
    },


    //拉新裂变2.0
    goToFissionPage(){
      this.data.vipPopInfo.success && this.data.vipPopInfo.success()
    },
    cancelFissionPage(){
      this.data.vipPopInfo.success && this.data.vipPopInfo.error();
    }
  }
})
